package com.px.chapter_Nov_1;

import java.util.Scanner;

public class text7_1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
//     第4题
/*     int a=100,b,c,d,k;
       while (a<100_000){
           b=a%10;
           c=a/10%10;
           d=a/100%10;
           k=a/1000%10;
           if(a==b*b*b+c*c*c+d*d*d+k*k*k){
               System.out.println(""+a+"="+d+"^3+"+c+"^3+"+b+"^3"+k+"^3");
           }
           a++;
       }*/
//for ()
 /*       int b,c,d,k;
        for (int a=100;a<100_000;a++) {
            b = a % 10;
            c = a / 10 % 10;
            d = a / 100 % 10;
            k = a / 1000 % 10;
            if (a == b * b * b + c * c * c + d * d * d + k * k * k) {
                System.out.println("" + a + "=" + d + "^3+" + c + "^3+" + b + "^3" + k + "^3");
            }
        }
*/
//        第3题
/*       double dd=0,ff=1,hh=3,pp=1;

       for (;pp>=10e-8;){
           pp=ff/hh*pp;
           ff=ff+1;
           hh=hh+2;
           dd=dd+pp;
           System.out.println(ff);
           System.out.println(hh);*/
       /*while (pp>=10e-8){
            pp=ff/hh*pp;
            ff=ff+1;
            hh=hh+2;
            dd=dd+pp;
            System.out.println(ff);
            System.out.println(hh);

        }*/
/*        System.out.println(dd+1);
        System.out.println((dd+1)*2);*/
//        第二题
        /*
        System.out.println("x的值");
        int x=scanner.nextInt();
        System.out.println("y的值");
        int y=scanner.nextInt();
        int i=1,o=1;
        while (i<=y){
            System.out.println(i);

            o=x*o;
            System.out.println(x);
            i++;

        }
        System.out.println(o);*/
        //第一个问题
        System.out.println("请输入一个非负整数来计算阶乘:");
        double m = scanner.nextInt();
        double i = -1, c = 1, f = 0;
        for (; m > 0; m--) {
            c = c * m;
            System.out.println("" + m + "\t" + c);

        /* while (m>0){
            c=c*m;
            m=m-1;
            System.out.println(""+m+"\t"+c);

        }*/


        }
        System.out.println(c);
    }
}